package cn.hesion.exersice;
/**
 * ClassName: BubbleSort <br/>
 * Description: <br/>
 * date: 2022/5/12 5:29<br/>
 *
 * @author Hesion<br />
 * @version
 * @since JDK 1.8
 */

/**
 *
 * @author: hesion
 * @create: 2022-05-12 05:29
 **/
public class BubbleSort {
    public static void main(String[] args) {

        int[] nums = new int[]{8,3,1,6,9};

        int n = nums.length;
        for (int i=0;i<n;i++){
            for (int j = 0; j <n-i-1; j++) {
                if(nums[j] > nums[j+1]){
                    int temp = nums[j+1];
                    nums[j+1]=nums[j];
                    nums[j] = temp;
                }
            }
        }
        for (int i = 0; i < nums.length; i++) {
            System.out.println(nums[i]+" ");
        }

    }
}
